require(['./config'],() =>{
	require(['jquery'],() =>{
		class Login{
			constructor() {
			    this.getLogin()
			}
			getLogin(){
				$('.login-deng').on('click',() =>{
					let name = $('#inputName').val()
					let pwd = $('#inputPwd').val()
					if(name==""){
						alert("请输入用户名")
						return false
					}if(pwd==""){
						alert("请输入密码")
						return false
					}
				$.ajax({
					method:'POST',
					url:'http://localhost/erShop/api/shop/login.php',
					data:{name},
					success: function (resp) {
					  if(resp.code ===200 ){
						  alert(resp.body.msg+"即将跳转回首页")
						  location.href="/index.html"
					  }else{
						  alert(resp.body.msg)
					  }
					},
					dataType:'json'
				})
				})
			}
		}
		new Login()
	})
})